package com.example.module_car.ui.addcar

import com.example.module_car.api.CarApiService
import com.example.module_car.api.MotorCircleNetModule
import com.example.module_car.model.AddCarEntity
import com.example.module_car.model.AddCarParam
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject


class AddCarRepository @Inject constructor(){
    @Inject
    @MotorCircleNetModule.NoticeApi
    lateinit var apiService: CarApiService

    fun getProvincesList() = flow {
        emit(apiService.getProvincesList())
    }.flowOn(Dispatchers.IO)
    fun getAddCar(param : AddCarParam) = flow {
        emit(apiService.getAddCar(param))
    }.flowOn(Dispatchers.IO)
    fun upDateCar(id : Int, param: AddCarParam) = flow {
        emit(apiService.upDateCar(id,param))
    }.flowOn(Dispatchers.IO)
}